#ifndef PATHNAME_H
#define PATHNAME_H

class PLIBEXP PathName
{
	public:
		PathName();
		PathName(const String&);
		~PathName();

		enum DirSepOption
		{
			NoDirSep,		// never inserts dirSep between concat()
			WithDirSep		// inserts dirSep only when needed
		};

		bool8 set(const String& path);
		bool8 concat(const String::Character& Ch);
		bool8 concat(const String& Tail, DirSepOption = WithDirSep);

		bool8 operator==(const PathName& Test);
		
		void shrink(int32 numChars);
		void makeEmpty();
		void replace(const String::Character& Find, const String::Character& With);

		bool8 endsWith(const String::Character& Ch) const;
		int32 getLen() const;

		uint32 getEndPos() const;			// word following last dirSep
		String getEnd() const;			// word following last dirSep
		void removeEnd();					// truncate at last dirSep

		operator const String&() const;		// NEVER (String&)0
		operator const uint16*() const;		// NEVER (uint16*)0

	protected:
		String path;

	private:
		PathName& operator=(PathName& copy);
};

inline int32
PathName::getLen() const
{
	return path.getLength();
}

inline
PathName::operator const String&() const
{
	return path;
}

inline
PathName::operator const uint16*() const
{
	return (const uint16*)path;
}

#endif
